export function formatRoutes(routerArr) {
  const arr = []
  let obj = {}
  routerArr.forEach(router => {
    const tmp = { ...router }
    if (tmp.children) {
      // 内部调用即递归
      tmp.children = formatRoutes(tmp.children)
      obj = {
        title: tmp.label,
        value: tmp.id,
        key: tmp.id,
        children: tmp.children
      }
    } else {
      const { label, id } = router
      obj = {
        title: label,
        value: id,
        key: id,
        children: tmp.children
      }
    }
    arr.push(obj)
  })
  return arr
}
